<%@page import="java.util.Map"%>
<%@page import="java.util.HashMap"%>
<link rel="javascript" type="text/javascript" href="js/bootstrap.js">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/header.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="javascript" type="text/javascript" href="js/scripts.js">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/small-business.css" rel="stylesheet">



<script>
    function edit(nmServlet, id) {
        $.ajax({
            type: 'GET',
            url: nmServlet + '?acao=editar&id=' + id,
            dataType: 'json',
            success: function (data) {
                if (data != null) {
                    console.log(data);
                    preencheForm(data);
                    $('#bModal').modal('show');
                }
            },
            error: function (xhr, status) {
                console.log(status);
            }
        });
        return false;
    }

    function deletar(nmServlet, id) {
        $.ajax({
            type: 'GET',
            url: nmServlet + '?acao=remover&id=' + id,
            success: function (data) {
                if (data.trim() == "Success") {
                    $('#msgAviso').html('Removido com Sucesso!');
                    $('#iconAviso').attr('class', 'glyphicon glyphicon-ok');
                    $('#avisoModal').modal('show');
                    atualizaPagina();

                } else {
                    $('#msgAviso').html('Erro!');
                    $('#iconAviso').attr('class', 'glyphicon glyphicon-ban-circle');
                    $('#avisoModal').modal('show');

                }
            },
            error: function (xhr, status) {
                console.log(status);
            }
        });
        return false;
    }



</script>




<script>
    function atualizaPagina() {
        $('#avisoModal').on('hidden.bs.modal', function () {
            location.reload();
        })
    }
</script>